/*
    8. Write a program in C to display the n terms of odd natural number and their sum . 
    Test Data
    Input number of terms : 10
    Expected Output :
    The odd numbers are :1 3 5 7 9 11 13 15 17 19
    The Sum of odd Natural Number upto 10 terms : 100
*/

#include <stdio.h>

int main(void){
    int num;
    printf("Input number of terms : ");
    scanf("%d", &num);
    printf("The odd numbers are :");
    int i = 0, sum = 0, a = 1;
    while(1){
        if(a & 1){
            i++;
            sum += a;
            printf("%d ", a);
            if(i == num){
                printf("\n");
                break;
            }                            
        }
        a++;
    }
    printf("The Sum of odd Natural Number upto 10 terms : %d\n", sum);

    return 0;
}